package com.hsource.doctorcenter.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hsource.common.utils.CommonResp;
import com.hsource.common.utils.resultUtils.controller.BaseController;
import com.hsource.doctorcenter.service.city.CityService;

import com.hsource.doctorcenter.util.http.OkHttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yangYang
 * @date  2020/9/21 15:22:22
 * @version 1.0
 * @describe 城市数据控制层
 */
@Controller
@RequestMapping("/citys")
public class CityController extends BaseController {

    @Autowired
    private CityService cityService;

    @PostMapping("/getCitys")
    @ResponseBody
    public CommonResp getCitys() {
        String citys = cityService.getCitys();
        JSONArray jsonArray= JSONObject.parseArray(citys);
        Map<String,Object> citysMap=new HashMap<>();
        citysMap.put("citys",jsonArray);
        return success(citysMap);
    }

}
